package example.file;

import java.io.File;

/**
 * Created by lenovo on 2016/11/4 0004.
 * File 类的 file.getParent() 方法来获取文件的上级目录
 */
public class SuperDir {
    public static void main(String[] args) {
        File file = new File("C:/File/demo.txt");
        String strParentDirectory = file.getParent();
        System.out.println("文件的上级目录为 : "
                + strParentDirectory);
    }
}
